package com.info.widgets.signUp;
import java.util.ArrayList;
import java.util.List;
import java.sql.*;

import com.info.widgets.ConnectionHelper;
import com.info.widgets.DAOException;
import com.info.widgets.Sign.Sign;
import com.info.widgets.signUp.SignUp;
public class SignUpService {
	 

	public ArrayList<SignUp> SignUpCreation(SignUp sign) throws DAOException {
		SignUp  sign1=new SignUp();
		Connection con = null;
		String dbtime = null;
		//String query = "SELECT * FROM mycaspian.sign_in";
		ArrayList<SignUp> arrayList = new ArrayList<SignUp>();
		try {
		con = ConnectionHelper.getConnection();
		Statement stmt = con.createStatement();
		//ResultSet rs = stmt.executeQuery(query);

		PreparedStatement pst = null;

		pst = con.prepareStatement("INSERT INTO mycaspian.sign_up(first_name,middle_name,last_name,date_of_birth,cits_user_id,company_email_id,passportnumber,phone_number,secured_question,answer,zip,country,city,state,captcha_code,id) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
		System.out.println("SignUpCreation ***"+sign.getFirstName());
		
		
		
		pst.setString(1, sign.getFirstName());
		pst.setString(2, sign.getMiddleName());
		pst.setString(3, sign.getLastName());
		
		pst.setLong(4, sign.getDateofbirth());
		pst.setString(5, sign.getCitsuserid());
		pst.setString(6, sign.getCompanyemailid());
		pst.setString(7, sign.getPassportNumber());
		pst.setString(8, sign.getSecuredquestion());
		pst.setString(9, sign.getAnswer());
		pst.setLong(10, sign.getZip());
		pst.setString(11,sign.getCountry());
		pst.setString(12, sign.getState());
		pst.setString(12,sign.getCity());
		pst.setLong(14, sign.getId());
		
		
		
		pst.executeUpdate();
		
		} catch (Exception e) {
			e.printStackTrace();
			throw new DAOException(e);
		} finally {
			ConnectionHelper.close(con);
		}
		return arrayList;
	}








}